﻿using HHXX.Common;
using HHXX.IDAL;
using System;
using System.Collections.Generic;
using System.Text;

namespace HHXX.DALFactory
{
    public class DbSessionFactory
    {

        public static IDbSession GetCurrentDbSession()
        {
            //一次请求共用一个实例 上下文都可以做到切换
            //return new DataModelContainer();
            IDbSession db = (IDbSession)CallContext.GetData("DbSession");
            if (db == null)
            {
                db = new DbSession();
                CallContext.SetData("DbSession", db);
            }
            return db;
        }

    }
}
